package com.agileboot.domain.airport.reform.db;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 整改通知书主表 Mapper 接口
 */
public interface SirReformMainMapper extends BaseMapper<SirReformMainEntity> {


    @Delete("DELETE FROM sir_reform_main WHERE inspection_check_id = #{inspectionCheckId}")
    int deleteByInspectionCheckId(@Param("inspectionCheckId") Long inspectionCheckId);

    @Delete("DELETE FROM sir_reform_main WHERE related_question_id = #{relatedQuestionId}")
    int deleteByRelatedQuestionId(@Param("relatedQuestionId") Long relatedQuestionId);

    // 新增批量查询SQL
    @Select("<script>SELECT * FROM sir_reform_main WHERE related_question_id IN " +
            "<foreach collection='relatedQuestionIds' item='id' open='(' separator=',' close=')'>#{id}</foreach></script>")
    List<SirReformMainEntity> getByRelatedQuestionIds(@Param("relatedQuestionIds") List<Long> relatedQuestionIds);

}
